[SOLVED] Store files in C# EXE file

Posted by sublay on Stack Overflow See other posts from Stack Overflow or by sublay
Published on 2010-06-07T12:25:13Z Indexed on 2010/06/10 0:12 UTC
Read the original article Hit count: 460

Filed under:
|
|

It is actually useful for me to store some files in EXE to copy to selected location. I'm generating HTML and JS files and need to copy some CSS, JS and GIFs.

Snippet

System.IO.File.WriteAllBytes(@"C:\MyFile.bin", ProjectNamespace.Properties.Resources.MyFile);

doesn't work for me!

On "WriteAllBytes" it says: "cannot convert from 'System.Drawing.Bitmap' to 'byte[]'" for image and "cannot convert from 'string' to 'byte[]'" for text file.

Help!

UPDATE: Solved below.

© Stack Overflow or respective owner

Related posts about c#

Related posts about file